﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NuIoc
{
    public interface IContainer
    {
        #region Non-generic

        object Resolve(Type type);

        void Register(Type type, DependencyLifetime dependencyLifetime = DependencyLifetime.Persistent);

        void Register(Type abstractType, Type concreteType, DependencyLifetime dependencyLifetime = DependencyLifetime.Persistent);

        void Register(Type type, Func<object> factory, DependencyLifetime dependencyLifetime = DependencyLifetime.Persistent);

        void Unregister(Type type);

        bool IsRegistered(Type type);

        IEnumerable<object> GetInstances(Type type);

        #endregion

        #region Generic

        T Resolve<T>();

        void Register<T>(DependencyLifetime dependencyLifetime = DependencyLifetime.Persistent)
            where T : class;

        void Register<TAbstract, TConcrete>(DependencyLifetime dependencyLifetime = DependencyLifetime.Persistent)
            where TConcrete : class, TAbstract;

        void Register<T>(Func<T> factory, DependencyLifetime dependencyLifetime = DependencyLifetime.Persistent)
            where T : class;

        void Unregister<T>()
            where T : class;

        bool IsRegistered<T>();

        IEnumerable<T> GetInstances<T>();

        #endregion

        IEnumerable<object> GetInstances();
    }
}
